﻿using System;
using System.Collections;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            Stack s = new Stack();
            s.Push('A');
            s.Push('B');
            s.Push('C');
            s.Push('D');
            Console.WriteLine("现在栈:");
            foreach(char i in s)
            {
                Console.WriteLine(i+"");
            }
            s.Push('K');
            s.Push('L');
            Console.WriteLine("加入后的栈:");
            foreach(char j in s)
            {
                Console.WriteLine(j + "");
            }
            //s.Pop();
            //s.Pop();
            Console.WriteLine("出栈的第一个数是:"+s.Pop());
            Console.WriteLine("出栈的第二个数是:"+s.Pop());
            Console.WriteLine("出栈的第二个数是:"+s.Pop());
            Console.WriteLine("出栈的第三个数是:"+s.Pop());
            Console.WriteLine("现在栈顶数是:"+s.Peek());
            //栈中还剩 (A，B)
            foreach(char h in s)
            {
                Console.WriteLine( h + "");
            }


        }
    }
}
